package com.ym521.ymrouter.facade.service;

import com.ym521.ymrouter.facade.template.IProvider;

import java.lang.reflect.Type;

/**
 * @author Ym
 * E-mail: 2435970206@qq.com
 * createTime:2023/12/23
 * explain:
 */
public interface SerializationService extends IProvider {

    /**
     * Parse json to object
     * USE @parseObject PLEASE
     * @param input json string
     * @param clazz object type
     * @return instance of object
     */
    @Deprecated
    <T> T json2Object(String input, Class<T> clazz);

    /**
     * Object to json
     * @param instance obj
     * @return json string
     */
    String object2Json(Object instance);

    /**
     * Parse json to object
     * @param input json string
     * @param clazz object type
     * @return instance of object
     */
    <T> T parseObject(String input, Type clazz);
}
